#ifndef GULL_SCENE_H
#define GULL_SCENE_H

#include "SceneGraph.h"
#include "SceneNode.h"
#include "ISceneNode.h"
#include <stack>


#include "CameraNode.h"

namespace gull {
    namespace core{
		
		
        
        typedef std::stack<gull::core::Matrix4x3*> matrixStack;
        
        class Scene
        {
        public:
            Scene();
            ~Scene();
            inline void addNode(ISceneNode* n);
            inline SceneNode* getRoot() const;
            void pushAndSetMatrix(const Matrix4x3& m);
			void popAndSetMatrix();
			void renderScene();
			void setCamera();
			void attachCamera(CameraNode& cam);
			inline const Matrix4x3* getWorldMatrix() const;
			
            
        protected:
			void initStackMatrix();
			
            SceneGraph* m_sceneGraph;
            matrixStack m_sceneMatrixStack;
			CameraNode* m_camera;
			Matrix4x3* m_base;
        };
        
        
        
		SceneNode*
        Scene::getRoot() const{
            return &(m_sceneGraph->m_root);
        }
        
        
        void
        Scene::addNode(ISceneNode* n){
            m_sceneGraph->addNode(n);
        }
		
		const Matrix4x3* Scene::getWorldMatrix() const{
			return m_sceneMatrixStack.top();
		}
        
    }
}
#endif